{include file="public/header" /}
{include file="public/banner_In" /}
<div class="layui-container">
    <div class="layui-row layui-col-space20">
        {include file="public/left" /}
        <div class="layui-col-sm9 layui-col-md10">
            {include file="public/location" /}
            <div class="layui-card fly-extend-doc layui-show body-height-page">
                <div class="layui-card-header"><h3 class="layui-inline layui-this">{$title}</h3></div>

                <div class="layui-card-body detail-body layui-text">
                    <blockquote class="layui-elem-quote layui-text">
                        {$content|raw}
                    </blockquote>
                    <div class="content">
                        <form class="layui-form" id="layuiForm">
                            {:token()}
                            <input type="hidden" name="id" value="5" />
                            <input type="hidden" name="modelField[site_id]" value="{$site_id}" />
                            <div class="layui-form-item">
                                <label class="layui-form-label">姓名</label>
                                <div class="layui-input-block">
                                    <input type="text" name="modelField[name]" required  lay-verify="required" placeholder="请输入姓名" autocomplete="off" class="layui-input" value="">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label layui-form-item-required">手机</label>
                                <div class="layui-input-block">
                                    <input type="text" name="modelField[phone]" required  lay-verify="required|phone" placeholder="请输入手机" autocomplete="off" class="layui-input" value="">
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label layui-form-item-required">邮箱</label>
                                <div class="layui-input-block">
                                    <input type="text" name="modelField[email]" required  lay-verify="required|email" placeholder="请输入邮箱" autocomplete="off" class="layui-input" value="">
                                </div>
                            </div>

                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label layui-form-item-required">留言内容</label>
                                <div class="layui-input-block">
                                    <textarea placeholder="请输入留言内容" class="layui-textarea" name="modelField[content]"></textarea>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <label class="layui-form-label layui-form-item-required">验证码</label>
                                <div class="layui-input-block verify-box">
                                    <input type="text" name="captcha" lay-verify="required" placeholder="验证码" autocomplete="off" class="layui-input" style="width: 200px">
                                    <img id="verify" src="{:captcha_src()}" alt="验证码" class="captcha">
                                </div>
                            </div>


                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                </div>
                            </div>
                        </form>

                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}

<script>
    //Demo
    layui.use('form', function(){
        var form = layui.form;
        //监听提交
        form.on('submit(formDemo)', function (data) {
            $.ajax({
                url:'/formguide/index/post.html',
                type:'post',
                data:data.field,
                dataType: 'json',
                success:function(data){
                    if(data.code==1){
                        layer.msg(data.msg,{icon: 1});
                        $("#layuiForm")[0].reset();
                        layui.form.render();
                    }
                    else{
                        layer.msg(data.msg,{icon: 2});
                        return false;
                    }
                },
                error:function(e){
                    layer.msg(data.msg,{icon: 2});
                    return false;
                },
            });
            return false;
        });
    });

    //刷新验证码
    $("#verify").click(function() {
        var verifyimg = $("#verify").attr("src");
        $("#verify").attr("src", verifyimg.replace(/\?.*$/, '') + '?' + Math.random());
    });
</script>
